package servlet.config;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 * 
 * @author amine
 *
 */
public class Config {

    static boolean init = false;
    static Properties props = new Properties();
    /**
     * 
     * @param filename
     */
	public static void setFile(InputStream filename) {
            if(!init){
		try {
			props.load(filename);
			init = true;
		} catch (Exception e) {
			init = false;
			e.printStackTrace();
		}
            }
	}
	/**
	 * 
	 * @param key
	 * @return
	 */
	public static String get(String key) {
            System.out.println(props.getProperty(key));
            if(init)
                return props.getProperty(key);
            return null;
	}
}
